// 下面的代码输出什么

const promise1 = new Promise((resolve, reject) => {
  setTimeout(() => {
    reject();
  }, 1000);
});
const promise2 = promise1.catch(() => {
  return 2;
});

console.log('promise1', promise1);
console.log('promise2', promise2);

setTimeout(() => {
  console.log('promise1', promise1);
  console.log('promise2', promise2);
}, 2000);


/* 
P1 pending 
P2 pending 

宏队列 setTimeout 1s   setTimeout 2s

打印p1 p2 

P1 reject undefined
P1 fulfilled 2 


*/

